<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>布局</title>
    <style>
        body{ 
        margin: 0;}
        .heard{
            height: 100px;
            background-color: teal;
        }
        .back{
            height: 100%;
            width: 100%;
            background-color: cadetblue;
        }
        /*嵌套选择器 空格代表后代*/
        .heard .left{
            height: 100%;
            width: 200px;
            background-color: dodgerblue;
            float: left;
            margin-left: 20px;
        }
        .heard .right{
            height: 100%;
            width: 200px;
            background-color: blueviolet;
            float: right;
            margin-right: 20px;
        }
        .content{
            height: calc(100vh - 100px - 50px);
            background-color: coral;
            /*超出部分隐藏*/
            /*overflow: hidden;*/
            /*超出产生滚动条，不超出没有滚动条*/
            overflow: auto;
            padding-top: 10px;
        }
        .content .child{
            width: calc((100% - 50px) / 4);
            height: 200px;
            background-color: burlywood;
            margin-right: 10px;
            margin-bottom: 10px;
            float: left; 
        }
        /*找到.child,并且child作为别人4n+1的元素*/
        .content .child:nth-child(4n+1){
            margin-left: 10px;
        }
        .footer{
            height: 50px;
            background-color: cyan;
            /*内部文字水平居中*/
            text-align: center;
            /*内部文字垂直剧中*/
            line-height: 50px;
        }
    </style>
</head>

<body>
    <!--头部-->
    <!--div.heard-->
    <div class='back'></div>
    <div class="heard">
        <div class="left"></div>
        <div class="right"></div> 
    </div>
    <!--体部-->
    <div class="content">
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
        <div class="child"></div>
    </div>
    <!--尾部-->
    <div class="footer">
        XXXXXXXXX
    </div>
</body>
</html>